/**
* @author Meng Zhang
**/

#include "stdafx.h"
#include "MVC.h"

IMPLEMENT_DYNAMIC(BufferListener,CWnd)
//BufferListener::BufferListener( BufferBase * _buffer ) : buffer(_buffer) {
//	buffer->AttachListener(this);
//}

BufferListener::BufferListener() : buffer(NULL) {
}

BufferListener::~BufferListener() {
//	buffer->DettachListener(this);
	if (buffer)
		buffer->DettachListener(this);
}

void BufferListener::ReAttachBuffer( BufferBase *_buffer ) {
	if (buffer)
		buffer->DettachListener(this);
	buffer = _buffer;
	if (buffer)
		buffer->AttachListener(this);
}

BufferBase* BufferListener::GetBuffer() {
	return buffer;
}

void BufferListener::UpdateFromBuffer() {

}